<?php
//Pagination navigation
$target_page = $this->Html->url(array('controller' => 'Contributions', 'action' => 'history'));
$pagination = $this->CustomPagination->paginate($target_page, $total_pages, $limit, $page, $adjacent);
?>
    <style>
        .row-action{
            cursor: pointer;
        }
    </style>

<?php
if($data){
        ?>
        <div class="table-responsive">
            <table class="table table-striped b-t text-sm" id="collections_tbl_list">
                <thead>
                <tr>
                    <th width="8%">Receipt Date</th>
                    <th width="9%">Receipt No.</th>
                    <th width="10%">Type</th>
                    <th width="10%">Member No.</th>
                    <th width="5%">Week</th>
                    <th width="5%">Month</th>
                    <th width="5%">Year</th>
                    <th width="22%">Payment Type</th>
                    <th width="18%">Amount</th>
                    <th width="8%">Action</th>
                </tr>
                </thead>
                <tbody>
                <?php
                foreach ($data as $item) {
                    ?>
                    <tr data-receipt-id="<?php echo $item['receipt_id']; ?>" data-contribution-id="<?php echo $item['contribution_id']; ?>">
                        <td data-receipt_dt="<?php echo $item['receipt_dt']; ?>"><?php echo $item['receipt_dt']; ?></td>
                        <td data-receipt_no="<?php echo $item['receipt_no']; ?>"><?php echo $item['receipt_no']; ?></td>
                        <td data-type="<?php echo $item['type']; ?>"><?php echo $item['type']; ?></td>
                        <td data-organisation_no="<?php echo $item['organisation_no']; ?>" data-organisation_member_id="<?php echo $item['organisation_member_id']; ?>"><?php echo $item['organisation_no']; ?></td>
                        <td data-week="<?php echo $item['week']; ?>"><?php echo 'Wk '.$item['week']; ?></td>
                        <td data-month="<?php echo $item['month']; ?>"><?php echo substr($months[$item['month']],0,3); ?></td>
                        <td data-year="<?php echo $item['year']; ?>"><?php echo $item['year']; ?></td>
                        <td data-payment_type="<?php echo $item['payment_type_id']; ?>" data-cheque_no="<?php echo $item['cheque_no']; ?>" ><?php echo $item['payment_type'].' &nbsp; '; echo (!empty($item['cheque_no']))? '( '.$item['cheque_no'].' ) '.$item['cheque_status']:''; ?></td>
                        <td data-amount="<?php echo $item['amount']; ?>" data-currency="<?php echo $item['currency_id']; ?>" ><?php echo $item['currency_code'].' '.$item['amount']; ?></td>
                        <td>
                            <i id="row-edit-btn_<?php echo $item['contribution_id']; ?>" class="row-action edit-btn  fa fa-edit text-success fa-2x" parent-data-id="<?php echo $item['contribution_id']; ?>"></i> &nbsp;
                            <i id="row-delete-btn_<?php echo $item['contribution_id']; ?>" class="row-action delete-btn fa fa-trash-o text-danger fa-2x" parent-data-id="<?php echo $item['contribution_id']; ?>"></i>
                            <i id="row-loader-btn_<?php echo $item['contribution_id']; ?>" class="row-loader fa fa-spinner fa-spin fa-2x " style="display: none"></i>
                            <i id="row-save-btn_<?php echo $item['contribution_id'];?>" class="row-action save-btn fa fa-save text-info fa-2x" style="display: none" parent-data-id="<?php echo $item['contribution_id']; ?>"></i>&nbsp;&nbsp;
                            <i id="row-cancel-btn_<?php echo $item['contribution_id'];?>" class="row-action cancel-btn fa fa-ban  text-danger fa-2x" style="display: none" parent-data-id="<?php echo $item['contribution_id']; ?>"></i>
                        </td>
                    </tr>
                <?php
                }
                ?>
                </tbody>
            </table>
        </div>
        <footer class="panel-footer">
            <div class="row">
                <div class="col-sm-4 hidden-xs">

                </div>
                <div class="col-sm-4 text-center">

                </div>
                <div class="col-sm-4 text-right text-center-xs">
                    <?php echo $pagination; ?>
                </div>
            </div>
        </footer>
    <?php

}
else{

}
?>